#ifndef CHARTWIDGET_H
#define CHARTWIDGET_H
#include <QWidget>
#include <QPushButton>
#include <QComboBox>
#include <QLabel>
#include <QStandardItemModel>
#include <QAbstractItemView>
#include <QList>
#include <QSqlQueryModel>
#include <QGridLayout>
#include <QTableView>
#include <QVBoxLayout>
#include <QSqlQuery>
#include <QPainter>


class ChartWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ChartWidget(QWidget *parent = 0);
private:
    QLabel* tagLabel;
    QComboBox* factoryComboBox;
    QPushButton* updateButton;
    QStandardItemModel* chartModel;
    void createChartModelView();
    void showChart();
private slots:
    void slotUpdateChart();
};


class PieView : public QAbstractItemView
{
    Q_OBJECT
public:
    explicit PieView(QWidget* parent=0);
    void paintEvent(QPaintEvent*);
    void setSelectionModel(QItemSelectionModel* selectionMode);
    QRegion itemRegion(QModelIndex index);
    QModelIndex indexAt(const QPoint &point) const;

    QRect visualRect(const QModelIndex &index) const;
    void scrollTo(const QModelIndex &index, ScrollHint hint=EnsureVisible);
    QModelIndex moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers);
    int horizontalOffset() const;
    int verticalOffset() const;
    bool isIndexHidden(const QModelIndex &index) const;
    void setSelection(const QRect &rect, QItemSelectionModel::SelectionFlags command);
    QRegion visualRegionForSelection(const QItemSelection &selection) const;

private:
    QItemSelectionModel* selections;
    QList<QRegion> regionList;

};

#endif // CHARTWIDGET_H
